
<%@ page import="Answer" %>
<html>
  <head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<meta name="layout" content="main" />
  <g:set var="entityName" value="${message(code: 'answer.label', default: 'Answer')}" />
  <title><g:message code="default.list.label" args="[entityName]" /></title>
</head>
<body>
  <div class="nav">
	<span class="menuButton"></span>
  </div>
  <div class="body">
	<h1><g:message code="default.list.label" args="[entityName]" /></h1>
	<g:if test="${flash.message}">
	  <div class="message">${flash.message}</div>
	</g:if>
	<div class="list">
	  <table>
		<thead>
		  <tr>

		<g:sortableColumn property="id" title="${message(code: 'answer.id.label', default: 'Id')}" />

		<g:sortableColumn property="userId" title="${message(code: 'answer.userId.label', default: 'User Id')}" />

		<g:sortableColumn property="userIp" title="${message(code: 'answer.userIp.label', default: 'User Ip')}" />

		<g:sortableColumn property="answerTime" title="${message(code: 'answer.answerTime.label', default: 'Answer Time')}" />

		<th><g:message code="answer.question.label" default="Question" /></th>

		<th><g:message code="answer.answerItems.label" default="Answer Items" /></th>
		</tr>
		</thead>
		<tbody>
		<g:each in="${answerInstanceList}" status="i" var="answerInstance">
		  <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">

			<td><g:link action="show" id="${answerInstance.id}">${fieldValue(bean: answerInstance, field: "id")}</g:link></td>

			<td>${fieldValue(bean: answerInstance, field: "userId")}</td>

			<td>${fieldValue(bean: answerInstance, field: "userIp")}</td>

			<td><g:formatDate date="${answerInstance.answerTime}" /></td>

		  <td>${fieldValue(bean: answerInstance, field: "question")}</td>

		  <td>
		  <g:if test="${answerInstance.question.type=='multi_select'}">
			<g:each in="${answerInstance.answerItems}" var="ai">
${ai.answerOrder}:${ai.questionItemId}&nbsp;&nbsp;
			</g:each>
		  </g:if>
		  <g:if test="${answerInstance.question.type=='answer'}">
${answerInstance?.at?.content}
		  </g:if>
		  </td>

		  </tr>
		</g:each>
		</tbody>
	  </table>
	</div>
	<div class="paginateButtons">
	  <g:paginate total="${answerInstanceTotal}" />
	</div>
  </div>
</body>
</html>
